package com.albon.util;

import java.util.Calendar;

public class Schedule_Calendar {
	String TAG = "Schedule_Calendar";
	Calendar mCalendar;
	
    int curYear;
    int curMonth;
    int curDay;
    
    public Schedule_Calendar(){
    	mCalendar = Calendar.getInstance();		
    	mCalendar.setTimeInMillis(System.currentTimeMillis());
        recalculate();
    }
    
    public void recalculate() {	   	 
        // set to the first day of the month
       // mCalendar.set(Calendar.DAY_OF_MONTH, 1);	
        curYear = mCalendar.get(Calendar.YEAR);
        curMonth = mCalendar.get(Calendar.MONTH);
        curDay = mCalendar.get(Calendar.DATE);
       // Logg.d(TAG, "curDay : "+curDay);
    }
    
    public void setPreviousMonth() {
        mCalendar.add(Calendar.MONTH, -1);
        recalculate();
    }
 
    public void setNextMonth() {
        mCalendar.add(Calendar.MONTH, 1);
        recalculate();	 
        
    }
    
    public void setPreviousDay() {
        mCalendar.add(Calendar.DATE, -1);
        recalculate();
    }
    
    public void setNextDay() {
    	//int end_date = mCalendar.getActualMaximum(Calendar.DATE);
        mCalendar.add(Calendar.DATE, 1);
        Logg.d(TAG, "date : "+mCalendar.get(Calendar.DATE));
    	recalculate();	 
        
    }
    
    public String getCurYear() {
        return curYear+"";
    }
 
    public String getCurMonth() {	    	
        int curM = curMonth+1;
        return curM>9?""+curM:"0"+curM;
    }
    
    public String getCurDay() {	    	
    	int curD = curDay;
    	return curD>9?""+curD:"0"+curD;
    }
    
}
